package com.zr.daoImpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import com.zr.dao.UserDao;
import com.zr.model.User;
import com.zr.util.JDBCUtil;

import net.sf.json.JSONArray;

public class UserDaoImpl implements UserDao{
     //修改密码 
	@Override
	public boolean updatePswByUid(int uid,String newpsw) {
		boolean flag=false;
		StringBuffer sql=new StringBuffer("");
		sql.append(" Update user set upsw=?");
		sql.append(" Where uid=?");
		Connection con=JDBCUtil.getConnection();
		PreparedStatement pst;
		try {
			pst=con.prepareStatement(sql.toString());
			pst.setString(1, newpsw);
			pst.setInt(2, uid);
			int i=pst.executeUpdate();
			if (i>0) {		
				flag=true;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return flag;
		
}
	
}
